-
Notifications
You must be signed in to change notification settings - Fork 1.9k
relay-transforms: optionally use native gql fragment spreads for unmasked fragments #4975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
relay-transforms: optionally use native gql fragment spreads for unmasked fragments #4975
Conversation
3718890 to
cdc91f3
Compare
|
Hi @sjbarag, thanks for the PR. However, we generally discourage the use of |
Heyyy @evanyeung! Netflix has ~300 uses of In the meantime though, this PR would reduce some of our query text strings by 93% (from 343_773 bytes to 22_078 bytes). That feels like a major win for anyone using |
cdc91f3 to
b64c530
Compare
(bump) Any further thoughts on whether this PR will be considered? 🙂 |
83f91d5 to
338f995
Compare
…sked fragments When Relay encountered a fragment spread with the `@relay(mask: false)` directive, it would previously inline that fragment text into the query itself. This is completely valid and equivalent to a native GraphQL fragment spread. That inlining can dramatically increase the size of serialize for a query with multiple fragments. Such repetition compresses extremely well, but clients and servers still pay the cost of having uncompressed strings in-memory (plus compress/decompress time). Allow relay users to opt out of fragment inlining for `@relay(mask: false)` fragment spreads in queries, using a native GraphQL fragment spread. The reader AST and type generation are not affected so there's no impact to the relay runtime.
338f995 to
21ae65e
Compare
|
(one last bump) @captbaritone could you please weigh in on whether this is something Meta will consider merging? |
When Relay encountered a fragment spread with the
@relay(mask: false)directive, it would previously inline that fragment text into the query itself. This is completely valid and equivalent to a native GraphQL fragment spread. That inlining can dramatically increase the size of serialize for a query with multiple fragments. Such repetition compresses extremely well, but clients and servers still pay the cost of having uncompressed strings in-memory (plus compress/decompress time).Allow relay users to opt out of fragment inlining for
@relay(mask: false)fragment spreads in queries, using a native GraphQL fragment spread. The reader AST and type generation are not affected so there's no impact to the relay runtime.CC @Lalitha-Iyer